import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/Layout.vue'
import StageSelectTest from '@/components/StageSelectTest.vue'
import SelectTest from '@/components/SelectTest.vue'
import Login from '@/views/login/index.vue'

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login,
    meta: { title: '登录' }
  },
  {
    path: '/stage-select-test',
    name: 'StageSelectTest',
    component: StageSelectTest,
    meta: { title: '学习阶段下拉框测试' }
  },
  {
    path: '/select-test',
    name: 'SelectTest',
    component: SelectTest,
    meta: { title: '下拉框测试' }
  },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/main',
    component: Layout,
    redirect: '/main/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: { title: '首页', icon: 'House' }
      }
    ]
  },
  {
    path: '/main/students',
    component: Layout,
    redirect: '/main/students/list',
    meta: { title: '学员管理', icon: 'User' },
    children: [
      {
        path: 'list',
        name: 'StudentList',
        component: () => import('@/views/students/list.vue'),
        meta: { title: '学员列表' }
      },
      {
        path: 'registration',
        name: 'StudentRegistration',
        component: () => import('@/views/students/registration.vue'),
        meta: { title: '报名登记' }
      },
      {
        path: 'archives',
        name: 'StudentArchives',
        component: () => import('../views/students/archives.vue'),
        meta: { title: '学员档案' }
      },
      {
        path: 'exams',
        name: 'StudentExams',
        component: () => import('../views/students/exams.vue'),
        meta: { title: '考试管理' }
      },
      {
        path: 'statistics',
        name: 'StudentStatistics',
        component: () => import('@/views/students/statistics.vue'),
        meta: { title: '成绩统计' }
      },
      {
        path: 'exams/detail/:id',
        name: 'ExamDetail',
        component: () => import('@/views/students/exams-detail.vue'),
        meta: { title: '考试详情' }
      }
    ]
  },
  {
    path: '/main/coaches',
    component: Layout,
    redirect: '/main/coaches/list',
    meta: { title: '教练管理', icon: 'UserFilled' },
    children: [
      {
        path: 'list',
        name: 'CoachList',
        component: () => import('@/views/coaches/list.vue'),
        meta: { title: '教练列表' }
      },
      {
        path: 'schedule',
        name: 'CoachSchedule',
        component: () => import('@/views/coaches/new-schedule.vue'),
        meta: { title: '排班管理' }
      },
      {
        path: 'evaluation',
        name: 'CoachEvaluation',
        component: () => import('@/views/coaches/evaluation.vue'),
        meta: { title: '教练评价' }
      },
      {
        path: 'workload',
        name: 'CoachWorkload',
        component: () => import('@/views/coaches/workload.vue'),
        meta: { title: '工作量统计' }
      },
      {
        path: 'add',
        name: 'CoachAdd',
        component: () => import('@/views/coaches/add.vue'),
        meta: { title: '添加教练' }
      },
      {
        path: 'edit/:id',
        name: 'CoachEdit',
        component: () => import('@/views/coaches/edit.vue'),
        meta: { title: '编辑教练' }
      },
      {
        path: 'detail/:id',
        name: 'CoachDetail',
        component: () => import('@/views/coaches/detail.vue'),
        meta: { title: '教练详情' }
      },
      {
        path: 'statistics',
        name: 'CoachStatistics',
        component: () => import('@/views/coaches/statistics.vue'),
        meta: { title: '教练统计' }
      },
      {
        path: 'arrangement',
        name: 'CoachArrangement',
        component: () => import('@/views/coaches/arrangement.vue'),
        meta: { title: '教练排班' }
      }
    ]
  },
  {
    path: '/main/appointments',
    component: Layout,
    redirect: '/main/appointments/schedule',
    meta: { title: '预约管理', icon: 'Calendar' },
    children: [
      {
        path: 'schedule',
        name: 'AppointmentSchedule',
        component: () => import('@/views/appointments/schedule.vue'),
        meta: { title: '预约排期' }
      },
      {
        path: 'list',
        name: 'AppointmentList',
        component: () => import('@/views/appointments/list.vue'),
        meta: { title: '预约列表' }
      },
      {
        path: 'statistics',
        name: 'AppointmentStatistics',
        component: () => import('@/views/appointments/statistics.vue'),
        meta: { title: '预约统计' }
      },
      {
        path: 'edit/:id',
        name: 'AppointmentEdit',
        component: () => import('@/views/appointments/edit.vue'),
        meta: { title: '编辑预约' }
      },
      {
        path: 'detail/:id',
        name: 'AppointmentDetail',
        component: () => import('@/views/appointments/detail.vue'),
        meta: { title: '预约详情' }
      }
    ]
  },
  {
    path: '/main/records',
    component: Layout,
    redirect: '/main/records/list',
    meta: { title: '学习记录', icon: 'Document' },
    children: [
      {
        path: 'list',
        name: 'LearningRecordList',
        component: () => import('@/views/records/list.vue'),
        meta: { title: '记录列表' }
      },
      {
        path: 'progress',
        name: 'LearningProgress',
        component: () => import('@/views/records/progress.vue'),
        meta: { title: '学习进度' }
      },
      {
        path: 'analysis',
        name: 'LearningAnalysis',
        component: () => import('@/views/records/analysis.vue'),
        meta: { title: '学习分析' }
      }
    ]
  },
  {
    path: '/main/statistics',
    component: Layout,
    redirect: '/main/statistics/overview',
    meta: { title: '数据统计', icon: 'DataLine' },
    children: [
      {
        path: 'overview',
        name: 'StatisticsOverview',
        component: () => import('@/views/statistics/overview.vue'),
        meta: { title: '统计总览' }
      },
      {
        path: 'revenue',
        name: 'RevenueStatistics',
        component: () => import('@/views/statistics/revenue.vue'),
        meta: { title: '收入统计' }
      },
      {
        path: 'business',
        name: 'BusinessAnalysis',
        component: () => import('@/views/statistics/business.vue'),
        meta: { title: '业务分析' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router